<?php
class DataProvider
{
	public static function ExecuteQuery($sql)
	{
		$connection = mysql_connect('localhost','root','') or
			die ("Couldn't connect to localhost");


		mysql_select_db('bookexchange',$connection);

		mysql_query("set names 'utf8'");

		$result = mysql_query($sql,$connection);

		mysql_close($connection);

		return $result;
	}

	public static function ChangeURL($path)
	{
		echo '<script type = "text/javascript">';
		echo 'location = "'.$path.'";';
		echo '</script>';
	}
}

$db_host = "localhost"; // Giữ mặc định là localhost
$db_name    = 'bookexchange';// Can thay doi
$db_username    = 'root'; //Can thay doi
$db_password    = '';//Can thay doi
@mysql_connect("{$db_host}", "{$db_username}", "{$db_password}") or die("Không thể kết nối database");
@mysql_select_db("{$db_name}") or die("Không thể chọn database");
?>
